initHeight = 400;
GradientData = readmatrix("virtual_line\line_info.xlsx","Sheet","坡度2");
GradientData(:,1:2) = GradientData(:,1:2).*1000;
% 从工作区取数据
grd_data = GradientData;
%% 计算坡度
init_h = initHeight;
h_(1) = init_h;
for j = 1:length(grd_data)
    h_(j+1) = h_(j) + (grd_data(j,2)-grd_data(j,1))*grd_data(j,3)/1000;
end
h_ = h_';

%% 画图
figure(11)
set(gcf,'Position',[1000,400,1000,300]);
hl1 = area([grd_data(:,1)./1000; grd_data(end,2)./1000],h_,'FaceColor',[0.7 0.7 0.7],'EdgeColor', [0.6 0.6 0.6],"FaceAlpha",0.35);
set(hl1, 'DisplayName', '坡度')
ylim([init_h-200 max(h_)+200]);
legend("坡度")
ylabel("相对海拔(m)");
xlabel("公里标(km)");
